home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / docs / mags / NoCover104.lha / NoCover104 / aa / extra / notizconnect.php < prev    next >
Text File  |  2002-09-21  |  703b  |  30 lines

  1. <!-- diese Datei außerhalb des Webspaces ablegen -->
  2.  
  3. <?php
  4.  
  5. /* Verbindung zur Datenbank herstellen */
  6. function connect()
  7. {
  8.   $mysqlhost     = "localhost";  /* mySQL Server */
  9.   $mysqluser     = "root";       /* User */
  10.   $mysqlpasswd   = "";           /* Password */
  11.   $mysqldatabase = "notizbuch";  /* Datenbankname */
  12.  
  13.   $connID = @mysql_pconnect($mysqlhost, $mysqluser, $mysqlpasswd);
  14.  
  15.   if($connID)
  16.   {
  17.     mysql_select_db($mysqldatabase);  /* Datenbank connectieren */
  18.     return( $connID );
  19.   }
  20.   else
  21.   {
  22.     echo "<BR><font color='red'>Keine Verbindung zur Datenbank möglich !</font><BR>\n";
  23.     echo "Fehlerursache: " . mysql_error() . "<BR>\n";
  24.     exit();  /* Skript abbrechen */
  25.   }
  26. }
  27.  
  28. ?>
  29.  
  30.